{	Problem: http://codeforces.ru/problemset/problem/23/B
	Verdict: Accepted
}
uses math;
var n,i,t:longint;
begin
read(t);
for i:=1 to t do begin
    read(n);
    writeln(max(0,n-2));
end;
end.